﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Web.Services;

public partial class Admin_LoaiPhukien : System.Web.UI.Page
{
    DanhmucPhukienController danhmucPhukien = new DanhmucPhukienController();
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            grvLoaiPhukien.DataSource = danhmucPhukien.GetAll();
            grvLoaiPhukien.DataBind();
            if(grvLoaiPhukien.Rows.Count>0)
            {
                grvLoaiPhukien.UseAccessibleHeader = true;
                grvLoaiPhukien.HeaderRow.TableSection = TableRowSection.TableHeader;
            }
        }
    }
    [WebMethod]
    public static string deleteLoaiPhukien(int id)
    {
        DanhmucPhukienController danhmucPhukienController = new DanhmucPhukienController();
        if(danhmucPhukienController.Delete(id)>0)
        {
            return "Xóa danh mục phụ kiện thành công";
        }
        else
        {
            return "Xóa danh mục phụ kiện gặp lỗi";
        }
    }
}